cmake_minimum_required(VERSION 3.1.4)

include_directories(${PROJECT_SOURCE_DIR}/src/main/jni/include)

add_library(
        player
        SHARED
        ${PROJECT_SOURCE_DIR}/src/main/jni/Player.cpp
)

find_library(log-lib log)
find_library(graphics jnigraphics)

add_library(avcodec SHARED IMPORTED)
set_target_properties(avcodec PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/src/main/jni/prebuilt/${ANDROID_ABI}/libavcodec-57.so)

add_library(avformat SHARED IMPORTED)
set_target_properties(avformat PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/src/main/jni/prebuilt/${ANDROID_ABI}/libavformat-57.so)

add_library(avutil SHARED IMPORTED)
set_target_properties(avutil PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/src/main/jni/prebuilt/${ANDROID_ABI}/libavutil-55.so)

add_library(swresample SHARED IMPORTED)
set_target_properties(swresample PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/src/main/jni/prebuilt/${ANDROID_ABI}/libswresample-2.so)

add_library(swscale SHARED IMPORTED)
set_target_properties(swscale PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/src/main/jni/prebuilt/${ANDROID_ABI}/libswscale-4.so)

target_link_libraries(player avcodec avformat avutil swresample swscale -landroid ${log-lib})